@echo off
if "%OS%" == "Windows_NT" setlocal

set CURRENT_DIR=%cd%
if not "%JAVA_HOME%" == "" goto gotHome
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_03
if exist "%JAVA_HOME%\bin\java.exe" goto okHome

:gotHome
if exist "%JAVA_HOME%\bin\java.exe" goto okHome
echo The JAVA_HOME environment variable is not defined correctly
echo This environment variable is needed to run this program
goto end

:okHome
set EXECUTABLE=%JAVA_HOME%\bin\java.exe
if exist "%EXECUTABLE%" goto okExec
echo Cannot find %EXECUTABLE%
echo This file is needed to run this program
goto end

:okExec
set CMD_LINE_ARGS=
:setArgs
if ""%1""=="""" goto doneSetArgs
set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
shift
goto setArgs

:doneSetArgs
set JAVA_OPTS=-server -Xms64m -Xmx64m
set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
set CLASS_PATH=%CURRENT_DIR%\build\opentss-0.9.1.jar;%CURRENT_DIR%\lib\commons-lang-2.4.jar;%CURRENT_DIR%\lib\commons-logging-1.1.1.jar

call "%EXECUTABLE%" %DEBUG_OPTS% %JAVA_OPTS% -classpath %CLASS_PATH% opentss.TcpEndpoint %CMD_LINE_ARGS%

:end